<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>阶乘</title>
    <script>
      function getFactorial(num) {
        let result = 1
        for (let i = num; i >= 1; i--) {
          result *= i
        }
        return result
      }
      let num = prompt('请您输入一个数字: ')
      console.log(getFactorial(num))
    </script>
  </head>
  <body></body>
</html>
